// 更新 用户个人基础信息 接口

const db = require('../db.js')

exports.put = (req, res) => {
  const { id, nickname, introductions } = req.body // 将传递进来的数据保存
  // console.log(req)
  // console.log(id, nickname, introductions)
  // const sql = `select * from users where id = "${req.body.id}"`
  const sql = `update users set nickname="${nickname}",introductions="${introductions}" where id = "${id}"`

  db.query(sql, (err, data) => {
    if (err) { // 数据库语句执行失败
      return res.send('错误' + err.sqlMessage)
    }
    res.send({
      // data,
      status: 200,
      message: '修改成功'
    })
  })
}
